const { merge } = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.config')

module.exports = merge(baseWebpackConfig, {
    mode: 'development',
    devtool: 'eval-source-map',
    module: {
        rules: [
            {
                test: /\.less$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'less-loader'
                ]
            }
        ]
    },
    devServer: {
        open: true,
        compress: true,
        hot: true,
        port: 8080, // 打包后的输出端口
        progress: false, // 打包过程中的打包进度条
        //设置代理
        proxy: {
            //匹配前缀为/api
            '/api': {
                //目标域名 ip
                target: 'https://cdn.ycku.com',
                //改变源
                changeOrigin: true,
                //重写 url， 去掉 /api
                pathRewrite: {
                    '^/api': ''
                }
            }
        }
    }
})